package com.hrp.controller;

import com.hrp.domain.Jxksdmk;
import com.hrp.domain.ResponseData;
import com.hrp.service.JxksdmkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by Administrator on 2018/8/10 0010.
 */
@RestController
@RequestMapping("jxksdm")
public class JxksdmController {

    @Autowired
    private JxksdmkService jxksdmkService;

    @RequestMapping("/getJxksdmByPage")
    public Map<String, Object> getJxksdmByPage(Integer kslb,Integer page, Integer rows){
        return jxksdmkService.getJxksdmByPage(kslb,page,rows);
    }

    @RequestMapping("/getJxksdm")
    public ResponseData getJxksdmByKslb(Integer kslb){
        try{
            return ResponseData.build(200,"获取数据成功",jxksdmkService.getJxksdmByKslb(kslb));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseData.build(500,"获取失败");
        }
    }

    @RequestMapping("/saveJxksData")
    public ResponseData saveJxksData(Jxksdmk jxksdmk){
        try{
            jxksdmkService.saveJxksData(jxksdmk);
            return ResponseData.ok();
        }catch (Exception e){
            e.printStackTrace();
            return ResponseData.build(500,"保存失败");
        }

    }

}
